# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=libc-dev
pkgver=0.7.2
pkgrel=5
pkgdesc="Meta package to pull in correct libc"
url="https://alpinelinux.org"
arch="noarch"
license="BSD-2-Clause AND BSD-3-Clause"
options="!check" # No test suite
makedepends_build=" "
makedepends_host=" "
makedepends="$makedepends_build $makedepends_host"
depends="$CLIBC-dev"
subpackages="libc-utils:utils bsd-compat-headers:bsdcompat"
source="sys-cdefs.h
	sys-queue.h
	sys-tree.h
	sgidefs.h
	"

prepare() {
	mkdir -p "$builddir"
}

package() {
	mkdir -p "$pkgdir"

	case "$CTARGET" in
	mips*)
		install -D "$srcdir"/sgidefs.h "$pkgdir"/usr/include/sgidefs.h
		;;
	esac
}

utils() {
	depends="$CLIBC-utils"

	mkdir -p "$subpkgdir"
}

bsdcompat() {
	pkgdesc="BSD compatibility headers (cdefs, queue, tree)"
	depends=""

	mkdir -p "$subpkgdir"
	case "$CLIBC" in
	musl)
		install -D "$srcdir"/sys-cdefs.h "$subpkgdir"/usr/include/sys/cdefs.h
		install -D "$srcdir"/sys-queue.h "$subpkgdir"/usr/include/sys/queue.h
		install -D "$srcdir"/sys-tree.h "$subpkgdir"/usr/include/sys/tree.h
		;;
	esac
}

sha512sums="
37c8fc73c7aea7b490f7850927e2bb91d12137c9e59e22c084146d515696dbc7973b5de92f4c987ba080dd2502ba83127006442c3f019b6447a620c0cae73178  sys-cdefs.h
2f0d5e6e4dc3350285cf17009265dddcbe12431c111868eea39bc8cb038ab7c1f2acacbb21735c4e9d4a1fd106a8fc0f8611ea33987d4faba37dde5ce6da0750  sys-queue.h
d9ac210d81feb8ad2655bc80fb065d3fe20ae4417b32b4a1711e6738a4870140005c13373b5d1846ef3ce5ae6da45f2dacef2092881eded0a2e94f6a07752ef3  sys-tree.h
7f8fc4b50aa88106adfba4971b2e441d6f480efef45ba8dce3b6c1235b1835a31883718e3d1f0606ad7366b965e52e00faf91c322e53f3af35da630126f26de4  sgidefs.h
"
